/*
 * Copyright (c) 2020 - present, Inspur Genersoft Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.inspur.edp.cef.generator.common;

import com.inspur.edp.cef.generator.CefGenServiceManager;
import com.inspur.edp.lcm.metadata.api.entity.GspMetadata;

public final class MetadataAdapter {

  public static GspMetadata getMetadata(String id) {
    return CefGenServiceManager.getLcmDtService().getRefMetadata(id);
  }


//TODO: java版临时注释 应该没人用先注释掉
//  public static java.lang.Class getCustomActionType(
//      String assemblyName, String className, String generatePath, String relativePath) {
//    //DataValidator.CheckForEmptyString(assemblyName, "assemblyName");
//    //DataValidator.CheckForEmptyString(className, "className");
//
//    Assembly assembly = null;
//    final String dllSuffix = ".dll";

//    var compDllPath =
//        Path.Combine(
//            MetadataUtil.GetBelongProjectOutputDir(relativePath), assemblyName + dllSuffix);
//    if (!MetadataUtil.getFsService().ExistsAsFile(compDllPath)) {
//      throw new GSPException(
//          "BeGen_1001", MetadataUtil.FormatExceptionMsg("构件程序集" + assemblyName + "不存在，请编译构件后重试。"));
//    }
//    String copiedDllPath = Path.Combine(relativePath, assemblyName + dllSuffix);
//    MetadataUtil.getFsService().Copy(compDllPath, copiedDllPath, true, true);
//    assembly = ReflectionUtil.GetAssemblyFromPath(generatePath, assemblyName);
//    if (assembly == null) {
//      throw new GSPException(
//          "BeGen_1002", MetadataUtil.FormatExceptionMsg("加载构件程序集" + assemblyName + "失败。"));
//    }
//
//    return assembly.GetType(className);
//  }
}
